import {CHANGE_DEVICES_VISIBILITY, SAVE_DEVICES} from "./const";
import {defaultDeviceListFilter} from "../../config/const";


const initState = {
  deviceList: null,
  deviceListFilter: defaultDeviceListFilter,
};

const reducer = (state = initState, {type, payload}) => {
    switch (type) {
        case SAVE_DEVICES:
            return {...state, ...payload};
      case CHANGE_DEVICES_VISIBILITY:
        return {...state, deviceListFilter: payload};
        default:
            return state;
    }
};

export default reducer;
